package com.travel.lib.base.retrofit;

import rx.Subscriber;

/**
 * Created by spc on 2017/4/26.
 */

public abstract class StringSubscriber extends Subscriber<String> {
    protected boolean isShowToat;

    @Override
    public void onStart() {
        super.onStart();
        isShowToat = false;
    }

    @Override
    public void onNext(String s) {
        onSuccess(s);
    }

    @Override
    public void onCompleted() {

    }

    @Override
    public void onError(Throwable e) {
        ResponseStatusErrorManager.exceptionHandler(e);
        haveError();
    }

    //status不为0 的时候错误
    protected void statusError(String status) {

    }

    // （ 状态不为0 和异常错误）子类可重写
    protected void haveError() {
    }

    public abstract void onSuccess(String data);

    protected void statusSuccess() {
    }
}
